<template>
	<view class="nav-box">
		<view class="nav-item" v-for="item in categorize"  :data-Businessid="item.type_id"   @click="enterDetailsPage(item.type_id,item.name,item.json)"> <!-- @tap="enterDetailsPage(item.id)" -->
			<view ><image class="image" :src="qiniu + item.image_id" ></image></view>
			<text>{{item.name}}</text>
		</view>
		<!-- <view class="nav-item"    @click="pinpai">
			<view ><image class="image" src="http://clzy.eonfox.com/b115b371358553355774bb15516655947586" ></image></view>
			<text>品牌</text>
		</view> -->
	</view>
</template>

<script>
	import eonfox from '@/components/eonfox/eonfox.js';
	import fns from '@/components/eonfox/fns.js';
	var ef = new eonfox();
	export default {
		name: "NavCenter",
		data() {
			return {
				qiniu:'',//七牛云地址
				categorize:[],//分类菜单
				flid:'',
				classifyTitle:'' //商品分类父级标题
			};
		},
		onShow:function(){
			this.load()
		},
		methods: {
			pinpai(){
				uni.navigateTo({
					url: '../../pagesB/brand-pages/brand-pages'
				});
			},
			enterDetailsPage(id,name) {
					uni.navigateTo({
						url: '../../pages/details/details?flid='+id+'&name='+name
						// &classifyTitle=xiaoming
					});
				
				console.log(id,name)
			},
			load(){
				var _this=this;
				ef.submit({
					request:{
						s:['APPLICATIONTYPEOPTION',[{module:"shop_goods_type","label":"APP首页菜单"}]],//分类菜单
						config:['APPLICATIONCONFIG'],//获取七牛云地址
					},
					callback(data){
						var re=fns.checkError(data,'s',function(errno,error){
							fns.err(error)
						})
						//七牛
						console.log('//七牛',re.qiniu);
						if(re.config && re.config.qiniu_domain){
							_this.qiniu=re.config.qiniu_domain
						}
						//分类菜单
						console.log('//分类菜单',re.s);
						if(re.s){
							_this.categorize=re.s
						}
					},
					error(err){
						fns.err('err',err,1)
					}
				})
			}
			
		}
		
	}
</script>

<style scoped lang="stylus" ref="stylesheet/stylus">
	.nav-box
		display flex
		flex-wrap wrap
		width 100%

		margin 50upx 0upx
		.nav-item
			display flex
			flex-direction column
			justify-content center
			align-items center
			width 20%
			font-size 24upx
			margin 20upx 0
			color #666666
			
			.image
				width 70upx
				height 70upx
</style>
